import { Schema } from "@/types/custom";
import { defineStore } from "pinia";
type dragStore = {
  activeId: string | number;
  activeObj: Schema | null;
};
export const useDragStore = defineStore("drag", {
  state: (): dragStore => ({
    activeId: -1, // 当前激活的id
    activeObj: null, // 当前激活的对象
  }),
  getters: {
    getActiveId(): string | number {
      return this.activeId;
    },
    getActiveObj(): Schema | null {
      return this.activeObj;
    },
  },
  actions: {
    setActiveId(id: string | number) {
      this.activeId = id;
    },
    setActiveObj(obj: Schema | null) {
      this.activeObj = obj;
    },
  },
});
